package graph.drawings;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Rectangle2D;

public abstract class AbtractDrawing {
	protected String key;
	protected boolean selected;
	protected Bound bound;
	
	public abstract void draw(Graphics2D g);
	
	public abstract boolean testHit(Point point);
	
	public void select(boolean selected) {
		this.selected = selected;
	}

	protected abstract void drawHandles(Graphics2D graphics);

	// draw a handle by a point
	protected void drawHandle(Graphics2D graphics, double x, double y) {
		Rectangle2D.Double rec = new Rectangle2D.Double(x - 4, y - 4, 8, 8);
		graphics.fill(rec);
	}

	public boolean isSelected() {
		return true;
	}
	
	public String getKey() {
		return this.key;
	}
}
